import socket 
import sys
import threading

# client

sockObj = None

recvThread = threading.Thread(group=None, target=recvMessage)

def getOpt():
    try:
        return (sys.argv[1:][0], sys.argv[1:][1])
    except Exception:
        print('ArgParsing: args decode error, defaulting values')
        return '127.0.0.1', '520'

def main():
    # Usage:  main.py <serverIP> <serverPort>
    # parsing server-host
    Addr = getOpt()
    print(f'Server addr: \"{Addr[0]}:{Addr[1]}\"')
    # trying to connect
    # creating threads
    sockObj = socket.socket(socket.IF_ANET, socket.SOCK_STREAM)
    sockObj.bind(Addr)
    recvThread.run()



def recvMessage():
    # recv Message from server
    while True:
        pass

def decodeMessage(msg):
    pass

if __name__ == '__main__':
    main()